extends layout

block content
    h1 #{title}

    div
        table.table
            if data[0]
                thead
                    tr
                        each value, key in data[0]
                            th= key
                        th
                        th
                            span.glyphicon.glyphicon-pencil(data-toggle="modal" data-target="#myModal")
            tbody
                each row in data
                    tr
                        each column in row
                            td= column
                        td
                            a(href="/Periodicals/#{row.ID}/delete"): span.glyphicon.glyphicon-trash
                        td
                            a(href="/Periodicals/#{row.ID}"): span.glyphicon.glyphicon-folder-open
    div.paginator
        ul.pagination
            - for(var i = 0; i < pages; i++)
                if page == i
                    li.active: a(href='/Periodicals/page#{i}') #{i}
                else
                    li: a(href='/Periodicals/page#{i}') #{i}


    div.modal.fade#myModal(tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true")
        div.modal-dialog
            div.modal-content
                div.modal-header
                    button.close(type="button" data-dismiss="modal" aria-hidden="true") &times;
                    h4.modal-title New periodical
                form(method="post" action="/Periodicals/create")
                    div.modal-body
                            input.form-control(type="text" placeholder="title" name="title")
                            br
                            input.form-control(type="text" placeholder="periodical type" name="type_title")
                            br
                            input.form-control(type="date" name="opened")
                    div.modal-footer
                        button.btn.btn-default(type="button" data-dismiss="modal") Close
                        button.btn.btn-primary(type="submit") Create


